﻿.steps {
    padding: 0;
    margin: 0;
    list-style: none;
    display: flex;
    overflow-x: auto;

    .step {
        &:first-child {
            margin-left: auto;
        }

        &:last-child {
            margin-right: auto;
        }
    }
}

.step {
    &:first-of-type {
        .step-circle::before {
            display: none;
        }
    }

    &:last-of-type {
        .step-container {
            padding-right: 0;
        }
    }
}

.step-container {
    box-sizing: content-box;
    display: flex;
    align-items: center;
    flex-direction: column;
    width: $step-container-width;
    min-width: $step-container-width;
    max-width: $step-container-width;
    padding-top: $step-container-padding-top;
    padding-right: $step-gutter;
}

.step-circle {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: $step-circle-size;
    height: $step-circle-size;
    color: $step-icon-color;
    border: $step-circle-border-width solid $step-icon-color;
    border-radius: 100%;
    background-color: $step-icon-background;

    &::before {
        content: '';
        display: block;
        position: absolute;
        top: 50%;
        left: -$step-circle-border-width;
        width: calc(#{$step-container-width} + #{$step-gutter} - #{$step-circle-size});
        height: $step-circle-border-width;
        transform: translate(-100%, -50%);
        color: $step-icon-color;
        background-color: currentColor;
    }
}

.step-text {
    color: $step-text-color;
    word-break: keep-all;
    text-align: center;
    margin-top: 0.25em;
}


.step-completed {
    .step-circle {
        color: $white;
        background-color: $step-icon-completed-color;
        border-color: $step-icon-completed-color;

        &::before {
            color: $step-icon-completed-color;
        }
    }

    .step-text {
        color: $step-icon-completed-color;
    }
}

.step-active {
    .step-circle {
        color: $white;
        background-color: $step-icon-active-color;
        border-color: $step-icon-active-color;

        &::before {
            color: $step-icon-active-color;
        }
    }

    .step-text {
        color: $step-text-active-color;
    }
}


@each $name, $value in $theme-colors {
    $color: $value;
    $color-invert: color-yiq($value);

    .step-#{$name} {
        .step-circle {
            color: $color;
            border-color: $color;
        }

        &.step-completed {
            .step-circle {
                color: $white;
                background-color: $color;
                border-color: $color;

                &::before {
                    color: $color;
                }
            }

            .step-text {
                color: $color;
            }
        }

        &.step-active {
            .step-circle {
                color: $white;
                background-color: $step-icon-active-color;
                border-color: $step-icon-active-color;
            }


            &::before {
                color: $step-icon-active-color;
            }

            .step-text {
                color: $step-text-active-color;
            }
        }
    }
}

.steps-content {
    margin: 1rem 0;

    > .step-panel {
        display: none;
    }

    > .active {
        display: block;
    }
}
